package com.qqtech.admin.context;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

import com.qqtech.core.common.enums.RespEnum;
import com.qqtech.core.common.util.TimeUtil;
import com.qqtech.core.frame.model.Result;

@ControllerAdvice
public class AdminExceptionHandler {
	private Logger log = LoggerFactory.getLogger(AdminExceptionHandler.class);

	@ExceptionHandler(Exception.class)
	@ResponseBody
	public Result handleUnexpectedServerError(Exception e) {
		e.printStackTrace();
		log.debug(TimeUtil.now() + "-系统出现异常：{}", e.getMessage());
		return new Result(RespEnum.EXCEPTION, "系统繁忙，请稍后再试");
	}
}
